package sky.cin.framework.network;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.TimeZone;

public class Utils {

    private static Calendar cd = Calendar.getInstance();
    private static SimpleDateFormat fmt = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);

    public static String generateDate() {
        return generateDate(fmt);
    }

    public static String generateDate(String format) {
        return generateDate(new SimpleDateFormat(format, Locale.US));
    }

    private static String generateDate(SimpleDateFormat fmt) {
        fmt.setTimeZone(TimeZone.getTimeZone("GMT"));
        return fmt.format(cd.getTime());
    }

}
